home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compendium Deluxe 2
/
LSD and 17bit Compendium Deluxe - Volume II.iso
/
a
/
prog
/
asmsrc
/
phagexsources.lha
/
source
/
MorphCode.s
< prev
next >
Wrap
Text File
|
1994-07-09
|
9KB
|
540 lines
; This just uses to GFX piccys to morph between, it uses 20 frames, and
; you can change the FrameHeight...
Opt c-
Section "Morpher Code",Code_c
Screen = $b0000
FrameHeight = 128
FrameSize = (32*FrameHeight)
IncDir Df1:
Start Movem.l d0-d7/a0-a6,-(sp)
Bsr KillSys
Lea CopperList(pc),a0
Lea HardWare,a6
Move.l a0,Cop1Lc(a6)
Move.w #$83c0,DMACon(a6)
Move.l FrameStart(pc),a0
Lea FirstPiccy(pc),a1
Bsr CopyPiccy
Move.l FrameEnd(pc),a0
Lea LastPiccy(pc),a1
Bsr CopyPiccy
Move.l FrameEnd(pc),a0
Add.l #FrameSize,a0
Lea LastPiccy(pc),a1
Bsr CopyPiccy
Lea ColourZero+2(pc),a0
Move.w #$f0f,(a0)
Bsr DoMorph
Lea ColourZero+2(pc),a0
Move.w #$000,(a0)
Loop Bsr Anim8
Btst #6,$Bfe001
Bne Loop
Bsr ReturnSys
Movem.l (sp)+,d0-d7/a0-a6
Moveq #0,d0
Rts
Anim8 Lea Screen,a0
Lea CopperBPLS(pc),a1
Move.w #21,d7
AnimLoop Move.l a0,d1
Move.w d1,6(a1)
Swap d1
Move.w d1,2(a1)
Bsr VBL
Move.w #$4000,d0
Wait Dbf d0,Wait
Bsr VBL
Btst #6,$Bfe001
Beq ExitAnim8
Add.l #FrameSize,a0
Dbf d7,AnimLoop
Bsr Pause
Sub.l #FrameSize,a0
Move.w #21,d7
AnimLoop1 Move.l a0,d1
Move.w d1,6(a1)
Swap d1
Move.w d1,2(a1)
Bsr VBL
Move.l #$4000,d0
Wait1 Dbf d0,Wait1
Bsr VBL
Btst #6,$Bfe001
Beq ExitAnim8
Sub.l #FrameSize,a0
Dbf d7,AnimLoop1
Bsr Pause
ExitAnim8 Rts
Pause Move.w #10,d3
WaitX1 Bsr VBL
Move.w #$2000,d0
WaitX Btst #2,$Dff016
Beq ExitPause
Btst #6,$Bfe001
Beq ExitAnim8
Dbf d0,WaitX
Bsr VBL
Dbf d3,WaitX1
ExitPause Rts
VBL Move.l $Dff004,d0
And.l #$1ff00,d0
Cmp.l #$13000,d0
Bne VBL
Rts
CopyPiccy Move.w #(FrameSize/4)-1,d0
CopyPicLoop Move.l (a1)+,(a0)+
Dbf d0,CopyPicLoop
Rts
DoMorph Lea MorphDatList(pc),a0
Move.l #$ffff0000,$00(a0)
Move.l #$ffff0000,$04(a0)
Move.l #$ffff0000,$82(a0)
Move.l #$ffff0000,$86(a0)
Lea FrameList(pc),a0
Move.w #18,d0
FrameCLear Move.w #(FrameSize/4)-1,d1
Move.l (a0)+,a1
GFXCLearLoop Move.l #0,(a1)+
Dbf d1,GFXCLearLoop
Dbf d0,FrameCLear
Move.l FrameStart(pc),a0
Move.l FrameEnd(pc),a1
Lea MorphDatList+4(pc),a2
Lea MorphDatList+$86(pc),a3
Lea MorphFlag(pc),a6
Or.b #3,(a6)
MorphFrame Move.w (a2)+,d0
Bge DoFrameDat1
Bra CalcFrame
GetFrame Lea MorphDatList(pc),a2
Bra MorphFrame
DoFrameDat1 Move.w (a2)+,d1
DoFrameDat2 Move.w (a3)+,d2
Bge CreateFrame
Bra CalcFrame1
GetHalfData Lea MorphDatList+$82(pc),a3
Bra DoFrameDat2
CreateFrame Move.w (a3)+,d3
Move.l a0,-(sp)
Lea PosTabList(pc),a0
Sub.w d0,d2
Sub.w d1,d3
Lsl.w #5,d2
Lsl.w #5,d3
Lea FrameList(pc),a4
Lea MorphBitList(pc),a6
Move.w #19,d7
Tst.w d2
Bmi MorphDat2
Tst.w d3
Bmi MorphDat1
FrameAddrLoop Move.l (a4)+,a5
Add.b 0(a6,d2.w),d0
Add.b 0(a6,d3.w),d1
Move.w d1,d4
Add.w d4,d4
Move.w 0(a0,d4.w),d4
Move.w d0,d5
Asr.w #3,d5
Add.w d5,d4
Moveq.l #7,d5
Sub.w d0,d5
Bset d5,0(a5,d4.w)
Addq.w #1,a6
Dbf d7,FrameAddrLoop
Move.l (sp)+,a0
Bra MorphFrame
MorphDat1 Neg.w d3
DoMorphSeg1 Move.l (a4)+,a5
Add.b 0(a6,d2.w),d0
Sub.b 0(a6,d3.w),d1
Move.w d1,d4
Add.w d4,d4
Move.w 0(a0,d4.w),d4
Move.w d0,d5
Asr.w #3,d5
Add.w d5,d4
Moveq.l #7,d5
Sub.w d0,d5
Bset d5,0(a5,d4.w)
Addq.w #1,a6
Dbf d7,DoMorphSeg1
Move.l (sp)+,a0
Bra MorphFrame
MorphDat2 Neg.w d2
Tst.w d3
Bmi MorphDat3
DoMorphSeg2 Move.l (a4)+,a5
Sub.b 0(a6,d2.w),d0
Add.b 0(a6,d3.w),d1
Move.w d1,d4
Add.w d4,d4
Move.w 0(a0,d4.w),d4
Move.w d0,d5
Asr.w #3,d5
Add.w d5,d4
Moveq.l #7,d5
Sub.w d0,d5
Bset d5,0(a5,d4.w)
Addq.w #1,a6
Dbf d7,DoMorphSeg2
Move.l (sp)+,a0
Bra MorphFrame
MorphDat3 Neg.w d3
DoMorphSeg3 Move.l (a4)+,a5
Sub.b 0(a6,d2.w),d0
Sub.b 0(a6,d3.w),d1
Move.w d1,d4
Add.w d4,d4
Move.w 0(a0,d4.w),d4
Move.w d0,d5
Asr.w #3,d5
Add.w d5,d4
Moveq.l #7,d5
Sub.w d0,d5
Bset d5,0(a5,d4.w)
Addq.w #1,a6
Dbf d7,DoMorphSeg3
Move.l (sp)+,a0
Bra MorphFrame
CalcFrame Lea MorphDatList(pc),a2
Move.w (a2),d4
Move.w 2(a2),d5
And.w #$ffe0,d4
DrawData Add.w #$20,d4
Cmp.w #$100,d4
Bne EndPosTab
Moveq.l #0,d4
Addq.w #1,d5
Cmp.w #FrameHeight,d5
Bne EndPosTab
Moveq.l #0,d5
Lea MorphFlag(pc),a6
And.b #$fe,(a6)
Tst.b (a6)
Beq EndByteDraw
Move.l FrameStart(pc),a0
EndPosTab Move.l (a0)+,d7
Beq DrawData
Moveq.l #$1f,d6
TestDrawBit Btst d6,d7
Beq NoDrawByte
Move.w d4,(a2)+
Move.w d5,(a2)+
NoDrawByte Addq.w #1,d4
Dbf d6,TestDrawBit
Move.w #$ffff,(a2)
Bra GetFrame
CalcFrame1 Lea MorphDatList+$82(pc),a3
Move.w (a3),d4
Move.w 2(a3),d5
And.w #$ffe0,d4
DrawData1 Add.w #$20,d4
Cmp.w #$100,d4
Bne EndPosTab2
Moveq.l #0,d4
Addq.w #1,d5
Cmp.w #FrameHeight,d5
Bne EndPosTab2
Moveq.l #0,d5
Lea MorphFlag(pc),a6
And.b #$fd,(a6)
Tst.b (a6)
Beq EndByteDraw
Move.l FrameEnd(pc),a1
EndPosTab2 Move.l (a1)+,d7
Beq DrawData1
Moveq.l #$1f,d6
TestNextDraw Btst d6,d7
Beq NoByteDraw
Move.w d4,(a3)+
Move.w d5,(a3)+
NoByteDraw Addq.w #1,d4
Dbf d6,TestNextDraw
Move.w #$ffff,(a3)
Bra GetHalfData
EndByteDraw Rts
KillSys Bsr.s SysWait
Move.l $4,a6
Lea GFXName(pc),a1
Moveq #0,d0
Jsr -552(a6)
Lea OldCop1(pc),a5
Move.l $26(a0),$0(a5)
Move.l $32(a0),$4(a5)
Lea HardWare,a6
Move.w IntEnaR(a6),d0
Move.w DMAConR(a6),d1
Or.w #$8000,d0
And.w #$03ff,d1
Or.w #$8000,d1
Move.w d0,$8(a5)
Move.w d1,$a(a5)
Move.w #$7fff,IntEna(a6)
Move.w #$7fff,DMACon(a6)
Rts
SysWait Move.w #15,d7
SysWaitLoop Move.l #$05000,d1
Bsr.s WaitVBL
Bsr.s DoWaitVBL
Dbf d7,SysWaitLoop
Rts
DoWaitVBL Move.l #$03000,d1
WaitVBL Movem.l d0-d1/a6,-(sp)
Lea HardWare,a6
WaitVBLLoop Move.l VPosR(a6),d0
And.l #$1ff00,d0
Cmp.l d1,d0
Bne.s WaitVBLLoop
Movem.l (sp)+,d0-d1/a6
Rts
ReturnSys Lea HardWare,a6
Move.w OldIntEna(pc),IntEna(a6)
Move.w OldDMACon(pc),DMACon(a6)
Move.l OldCop1(pc),Cop1lc(a6)
Move.l OldCop2(pc),Cop2lc(a6)
Rts
GFXName Dc.b "graphics.library",0
Even
OldCop1 Dc.l 0
OldCop2 Dc.l 0
OldIntEna Dc.w 0
OldDmaCon Dc.w 0
MorphFlag Dc.w 0
FrameStart Dc.l Screen
FrameList
A Set FrameSize
Rept 19
Dc.l Screen+A
A Set A+FrameSize
Endr
FrameEnd Dc.l Screen+A
Cmv Macro
Dc.w \2,\1
EndM
Cwt Macro
Dc.w (\1*$100)+$01,$fffe
EndM
Pal Macro
Dc.w $ffe1,$fffe
EndM
EndCop Macro
Dc.w $ffff,$fffe
EndM
CopperList Cwt $15
Cmv $0200,BplCon0
Cmv $00bb,BplCon1
Cmv $000a,BplCon2
Cmv $0040,DdfStrt
Cmv $00b8,DdfStop
Cmv $169e,DiwStrt
Cmv $36a3,DiwStop
Cmv $0,BplMod1
Cmv $0,BplMod2
Cwt $25
ColourZero Cmv $0000,Color00
Cmv $0fff,Color01
CopperBPLS Cmv $a,BplPt0h
Cmv $0,BplPt0l
Cmv $0,BplPt1h
Cmv $0,BplPt1l
Cmv $0,BplPt2h
Cmv $0,BplPt2l
Cmv $0,BplPt3h
Cmv $0,BplPt3l
Cmv $0,BplPt4h
Cmv $0,BplPt4l
Cwt $28
Cmv $1200,BplCon0
Cwt $a7
Cmv $0200,BplCon0
Pal
Cwt $28
Cmv $0200,BplCon0
EndCop
MorphDatList Incbin df0:SysData/Morph3e60c.Dat
PosTabList Incbin df0:SysData/PosTab.Dat
MorphBitList Incbin df0:SysData/MorphBitTab.Dat
FirstPiccy Incbin df0:BitMaps/FirstFrame.Raw
Ds.b $3000
LastPiccy Incbin df0:BitMaps/LastFrame.Raw
Ds.b $3000
****Custom Chip Registers****
Hardware = $Dff000
;Control Registers
Dmaconr = $002
Vposr = $004
Vhposr = $006
Joy0dat = $00A
Joy1dat = $00C
Clxdat = $00E
Intenar = $01C
Intereqr = $01E
Copcon = $02E
;Blitter Registers
Bltcon0 = $040
Bltcon1 = $042
Bltafwm = $044
Bltalwm = $046
Bltcpth = $048
Bltcptl = $04A
Bltbpth = $04C
Bltbptl = $04E
Bltapth = $050
Bltaptl = $052
Bltdpth = $054
Bltdptl = $056
Bltsize = $058
Bltcmod = $060
Bltbmod = $062
Bltamod = $064
Bltdmod = $066
Bltcdat = $070
Bltbdat = $072
Bltadat = $074
;Copper Registers
Cop1lc = $080
Cop1lch = $080
Cop1lcl = $082
Cop2lc = $084
Cop2lch = $084
Cop2lcl = $086
Copjmp1 = $088
Copjmp2 = $08A
Diwstrt = $08E
Diwstop = $090
Ddfstrt = $092
Ddfstop = $094
Dmacon = $096
Clxcon = $098
Intena = $09A
Intreq = $09C
;BitPlane Registers
BplCon0 = $100
BplCon1 = $102
BplCon2 = $104
BplMod1 = $108
BplMod2 = $10a
BplPt0h = $0e0
BplPt0l = $0e2
BplPt1h = $0e4
BplPt1l = $0e6
BplPt2h = $0e8
BplPt2l = $0ea
BplPt3h = $0ec
BplPt3l = $0ee
BplPt4h = $0f0
BplPt4l = $0f2
BplPt5h = $0f4
BplPt5l = $0f6
;Colour Registers
Color00 = $180
Color01 = $182
Color02 = $184
Color03 = $186
Color04 = $188
Color05 = $18a
Color06 = $18c
Color07 = $18e
Color08 = $190
Color09 = $192
Color10 = $194
Color11 = $196
Color12 = $198
Color13 = $19a
Color14 = $19c
Color15 = $19e
Color16 = $1a0
Color17 = $1a2
Color18 = $1a4
Color19 = $1a6
Color20 = $1a8
Color21 = $1aa
Color22 = $1ac
Color23 = $1ae
Color24 = $1b0
Color25 = $1b2
Color26 = $1b4
Color27 = $1b6
Color28 = $1b8
Color29 = $1ba
Color30 = $1bc
Color31 = $1be
EcsNop = $1fe